home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_co-op_room.cog < prev    next >
Text File  |  1999-11-15  |  26KB  |  954 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Vol_CO-op_Room.cog
  4. #
  5. # Sophia helps Indy through a critical gate
  6. #
  7. # [CMG & revised by HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14. # ................... MESSAGES ...................
  15.  
  16.     message    damaged
  17.     message    startup        
  18.     message    crossed    
  19.     message    activated        
  20.     message    user0        
  21.     message    entered
  22.     
  23. # ................. COGS ....................
  24.     cog        hintcog
  25.  
  26. # ................. KEYFRAMES ....................
  27.  
  28.     keyframe    in_pushHat=0in_figithat_4_4.key            local
  29.     keyframe    in_rtarmup=0in_armsout_1_1.key            local
  30.     keyframe    in_botharmsup=0in_armsup_1_1.key        local
  31.     keyframe    in_ltarmup=0in_leftarm_1_1.key            local
  32.     
  33.     keyframe    in_handsSide=0in_stand1.key                local
  34.     keyframe    in_armsCrossed=0in_stand2.key            local
  35.     keyframe    in_handsOnHips=0in_stand4.key            local
  36.     keyframe    in_crossArms=0in_stand1_bd_2.key           local
  37.     keyframe    in_handsToHips=0in_stand1_bd_4.key           local
  38.     keyframe    in_handsToSide=0in_stand4_bd_1.key           local
  39.     keyframe    in_activate=in_activate_medium.key        local
  40.     
  41.     keyframe    in_free=in_reach_low.key                local
  42.     keyframe    in_getdown=0in_stand1_bd_6.key            local
  43.     keyframe    in_getup=0in_stand6_bd_1.key            local
  44.     keyframe    in_releasing=0in_stand6.key                local
  45.  
  46.     keyframe    in_leftarm=0in_leftup_1_1.key            local
  47.     keyframe    in_brushoff=0in_cleanspants_1_1.key        local
  48.     keyframe    chinrub=0in_thinking_4_4.key            local
  49.     keyframe    in_grunt=0in_bar_attempt_1_1.key        local
  50.  
  51.     keyframe    so_nospook=0so_nothingspooky_2_2.key    local
  52.     keyframe    so_whatswitch=0so_whatswitch_2_2.key    local
  53.     keyframe    so_youokay=0so_youokay_2_2.key            local
  54.     keyframe    so_pushbutton=0so_activate_med_2_2.key    local
  55.     keyframe    so_ltwave=0so_leftwave_2_2.key            local
  56.  
  57. # ................. SAY LINES ....................
  58.  
  59.     sound    in_sturdygate=VL04J01.WAV            local # that gate looks pretty sturdy...    
  60.     sound    in_needhelp=VL04J02.WAV                local # That was fast. I'll need help...
  61.     sound    in_nowork=Inxj089.wav                local # That didn't work.
  62.     sound    in_notquitework=Inxj092.wav            local # Hmm, that didn't quite work.
  63.     sound    in_differentway=Inxj095.wav            local # There must be a...different way.
  64.     sound    in_goodidea=Inxj093.wav                local # Good idea, but not good enough.
  65.     sound    in_cantopen=Inxj096.wav                local # I can't open it.
  66.     sound    in_nobudge=Inxj098.wav                local # It won't budge.
  67.     sound    in_holdingdoor=Inxj099.wav            local # Something is holding this door closed.
  68.     sound   in_doorislocked=INXJ076.WAV            local # This door is locked.
  69.     sound   in_itslocked=INXJ077.WAV            local # It's locked.
  70.     
  71.     sound    in_line1=VL06J01.WAV                local # Here you are...
  72.     sound    in_opengate=Vl06j04a.wav            local # it opens the gate up there.
  73.     sound    in_workpush=Vl06j04b.wav            local # let me work into pos...then push.
  74.     sound    in_line3=VL06J06.WAV                local # push, sophia.
  75.     sound    in_line4=VL06J08.WAV                local # I can't open it from here...
  76.     sound    in_line5=VL06J10.WAV                local # wait! premonition...?
  77.     sound    in_line6=VL06J12.WAV                local # I like her optimism!
  78.     
  79.     sound    so_line1=VL06S02.WAV                local # nothing spooky...
  80.     sound    so_line2=VL06S03.WAV                local # what's this switch?
  81.     sound    so_line3=VL06S05.WAV                local # say when...
  82.     sound    so_line4=VL06S07.WAV                local # Indy, you ok?
  83.     sound    so_line5=VL06S09.WAV                local # doesn't matter, I'm spying....
  84.     sound    so_line6=VL06S11.WAV                local # yes, but the danger is further ahead...
  85.  
  86. # ............... SOUND EFFECTS ..................
  87.  
  88.     sound    squeak=shs_creaky_a2.wav            local
  89.     sound    whip_cue=mus_gen_indy_a_weird.wav    local
  90.     sound    fear_cue=mus_gen_awesome3.wav        local
  91.     
  92.     sound    gatestart=shw_grill_start.wav        local
  93.     sound    gatemove=shw_grill_move.wav           local
  94.     sound    gatestop=shw_grill_stop.wav            local
  95.      
  96. # .................. OBJECTS .....................    
  97.  
  98.     thing        gate
  99.     ### thing        invisiblock_4                    nolink
  100.     thing        strut                            # mask=0x08
  101.  
  102. # .................. ACTORS ......................
  103.         
  104.     thing        player                            local
  105.     thing        sophia          
  106.     thing        button          
  107.     thing        indy          
  108.              
  109. # .............. CAMERA THINGS ...................
  110.  
  111.     thing    cam1                                nolink
  112.     thing    cam2                                nolink
  113.     thing    cam3                                nolink
  114.     thing    cam4                                nolink
  115.     thing    cam5                                nolink
  116.     thing    cam5a                                nolink
  117.     thing    cam6                                nolink
  118.     thing    cam7                                nolink
  119.     thing    cam8                                nolink
  120.     thing    cam9                                nolink
  121.     thing    cam10                                nolink
  122.     thing    cam11                                nolink
  123.     thing    cam12                                nolink
  124.  
  125.     thing    slewcam                                local # var
  126.  
  127. # ........... CAMERA TARGET THINGS ...............
  128.  
  129.     thing    camtarget1                            nolink
  130.     thing    camtarget2                            nolink
  131.     thing    camtarget3                            nolink
  132.     thing    camtarget4                            nolink
  133.     thing    camtarget5                            nolink
  134.     thing    camtarget6                            nolink
  135.     thing    camtarget7                            nolink
  136.     
  137.     thing    spot_object                            nolink
  138.     thing    finalshot_targ                        nolink
  139.  
  140. # ............ ACTOR TARGET THINGS ...............
  141.  
  142.     thing    in_move1                            nolink
  143.     thing    in_move2                            nolink
  144.     thing    in_move3                            nolink
  145.     thing    in_move4                            nolink
  146.     thing    in_move5                            nolink
  147.     thing    in_move6                            nolink
  148.     thing    in_move7                            nolink
  149.     thing    in_nohitspot                        nolink
  150.     
  151.     thing    so_switchpos                        nolink
  152.     thing    so_move1                            nolink
  153.     thing    so_move2                            nolink
  154.     thing    so_move3                            nolink
  155.     thing    so_move4                            nolink
  156.     thing    so_move5                            nolink
  157.  
  158.     thing    inso_look_1                            nolink
  159.  
  160. # .................... ROUTINES ......................
  161.     flex    randneglines                        local
  162.     flex    randnobudgelines                    local
  163.  
  164.  
  165. # ...... MISCELLANEOUS ENGINE REFERENCES .........
  166.  
  167.     sector        scenesect
  168.     sector        doorSector
  169.  
  170.     surface        rockface
  171.  
  172.     template    tempRefIndy=ghost                local
  173.  
  174. # ................. VARIABLES ....................
  175.  
  176.     vector    camPos                                local
  177.     
  178.     
  179.     vector    v_clvec                                local    # look vector of the spotobject
  180.     vector    v_crvec                                local    # right vector of the spot object
  181.     vector    v_aimci                                local    # aim vector between spot object and player
  182.  
  183.     int        i_spot_NSorient                        local    # int for player position storage
  184.     int        i_spot_WEorient                        local    # int for player position storage
  185.     
  186.     flex    f_dotl                                local    # quadrant calculation
  187.     flex    f_dotr                                local   # quadrant calculation
  188.  
  189.     flex    openspeed=1.0                        local     # was 2.0
  190.     flex    shutspeed=6.0                        local
  191.  
  192.     flex    in_rotRate                            local
  193.     flex    so_rotRate                            local
  194.     flex    sophiaMass                            local
  195.     flex    newline                                local
  196.     flex    oldline                                local
  197.  
  198.     int        in_keyTrack1                        local
  199.     int        in_keyTrack2                        local
  200.  
  201.     int        so_keyTrack1                        local
  202.  
  203.     int        curCam                                local
  204.     int        curSound                            local
  205.     
  206.     int        open=0                                local
  207.     int        whipsaid=0                            local
  208.     int        gatesaid=0                            local
  209.     int        inthezone=0                            local
  210.     int        switchTalkState=0                    local
  211.     int        beyondgate=0                        local
  212.     
  213.     # sound hack workaround                        10/12/99 cmg
  214.     int        gate_snd0                            local
  215.     
  216.     int        fadechan                            local        #for fading down last ominous music cue
  217.     
  218. end
  219.  
  220. # ==============================================================================
  221.  
  222. code
  223.  
  224. # ..............................................................................
  225.  
  226. startup:
  227.  
  228.     player = GetLocalPlayerThing();
  229.     
  230.     sophiaMass = GetThingMass(sophia);
  231.  
  232.     SetThingFlags(sophia, 0x80000);
  233.     SetThingFlags(indy, 0x80000);
  234.     
  235.  
  236.     return;
  237.  
  238. # ..............................................................................
  239.  
  240. user0:
  241.  
  242.     # NOTE: sent by cog that runs the cutscene when Sophia is freed
  243.     
  244.     inthezone = 1;
  245.     ClearThingFlags(sophia, 0x80000); # now she's standing by the switch
  246.     SetThingMass(sophia, 0);
  247.     AIClearMode(sophia, 0x2000);
  248.  
  249.     return;
  250.  
  251. # ..............................................................................
  252.  
  253. activated:
  254.  
  255.     If (GetSenderRef() == button && inthezone == 0)
  256.     {
  257.         # Indy pushes the button to open the gate
  258.  
  259.         # Prep...
  260.         StartCutScene(1);
  261.         StopThing(player);
  262.         SetActorFlags(player, 0x200000);
  263.         DeselectWeaponWait(player); # stow any weapon or lighter
  264.         
  265.         
  266.         Sleep(0.5); # wait a beat
  267.         CopyPlayerHolsters(player, indy); # make sure actor has matching props
  268.         in_rotRate = GetThingMaxRotVel(player);
  269.         SetThingFlags(player, 0x80000);
  270.         ClearThingFlags(indy, 0x80000);
  271.         SetThingMaxRotVel(indy, 200.0);
  272.         TeleportThing(indy, in_move1); # align Indy            
  273.         curCam = GetCurrentCamera();
  274.         SetCameraPosInterp(2, 0); # no dolly
  275.         SetCameraLookInterp(2, 0); # no pan & tilt
  276.         
  277.         # Cut to side shot from left...
  278.         SetCameraFocus(2, cam1);
  279.         SetCameraSecondaryFocus(2, camtarget1);
  280.         SetCurrentCamera(2);
  281.         SetCameraFOV(50, 0, 0.0);
  282.         Sleep(0.2);
  283.  
  284.         # Indy punches the button...
  285.         PlayKey(indy, in_activate, 4, 0x12, 0);
  286.         Sleep(0.2);
  287.         MoveToFrame(button, 1, 0.5);
  288.         Sleep(1.0);
  289.  
  290.         # Show gate open & close...
  291.         If (gatesaid == 0)
  292.         {
  293.             # Slew camera the first time...
  294.             SetCameraPosInterp(2, 1); # dolly
  295.             SetCameraLookInterp(2, 1); # pan & tilt
  296.             SetCameraInterpSpeed(2, 2.5);
  297.             Sleep(0.01);
  298.             SetCameraFocus(2, cam2);
  299.             SetCameraSecondaryFocus(2, camtarget2);
  300.             SetCameraFOV(30, 1, 5.3);
  301.         }
  302.         else
  303.         {
  304.             # And cut thereafter...
  305.             SetCameraFocus(2, cam2);
  306.             SetCameraSecondaryFocus(2, camtarget2);
  307.             SetCameraFOV(30, 1, 5.0);
  308.             Sleep(0.01);
  309.         }
  310.  
  311.         # Indy looks toward gate offscreen...
  312.         AISetLookThing(indy, inso_look_1); # cheat look to gate
  313.  
  314.         
  315.         # Gate opens...
  316.         PlaySoundLocal(gatestart, 1.0, 0.0, 0x0, 0);
  317.         MoveToFrame(gate, 1, openspeed);
  318.         gate_snd0=PlaySoundLocal(gatemove, 1.0, 0.0, 0x1, 0);
  319.         WaitForStop(gate);
  320.         StopSound(gate_snd0, 0.0);
  321.         PlaySoundLocal(gatestop, 1.0, 0.0, 0x0, 0);
  322.         Sleep(1.0);
  323.         
  324.         # Fix stuff offscreen...
  325.         MoveToFrame(button, 0, 3.0);
  326.         TeleportThing(indy, in_move2); # re-spot actor
  327.         AISetLookThing(indy, inso_look_1);
  328.  
  329.         # Gate closes...
  330.         PlaySoundLocal(gatestart, 1.0, 0.0, 0x0, 0);
  331.         MoveToFrame(gate, 0, shutspeed);
  332.         gate_snd0=PlaySoundLocal(gatemove, 1.0, 0.0, 0x1, 0);
  333.         WaitForStop(gate);
  334.         StopSound(gate_snd0, 0.0);
  335.         PlaySoundLocal(gatestop, 1.0, 0.0, 0x0, 0);
  336.         Sleep(0.5);    
  337.     
  338.         If (gatesaid == 0)
  339.         {
  340.             # Cut to Indy...
  341.             SetCameraPosInterp(2, 0); # kill dolly
  342.             SetCameraLookInterp(2, 0); # kill pan & tilt
  343.             SetCameraFocus(2, cam3);
  344.             SetCameraSecondaryFocus(2, camtarget1);
  345.             SetCameraFOV(55, 0, 0.0);
  346.             Sleep(0.01);
  347.             SetCameraFOV(45, 1, 3.0); # zoom in
  348.     
  349.             # Indy: "Uh-oh.  That was fast...need some help..."
  350.             in_keyTrack1 = PlayKey(indy, in_armsCrossed, 2, 0x10, 0);
  351.             PlayKey(indy, in_crossArms, 4, 0x12, 0);
  352.             Sleep(0.2);
  353.             PlayVoice(indy, in_needhelp, 2, 1);
  354.         }
  355.  
  356.         # Cut back to follow camera...
  357.         TeleportThing(indy, in_move2); # align Indy on gate
  358.         TeleportThing(player, indy); # match 'em
  359.         camPos = GetThingPos(cam1);
  360.         SetCameraPosition(1, camPos); # prep to swing back to follow-cam
  361.         SetCurrentCamera(curCam);
  362.         ResetCameraFOV(0, 0.0);
  363.         RestoreExtCam();
  364.         
  365.         # Indy's residual commentary...
  366.         if (gatesaid == 1)
  367.         {
  368.             call randneglines;
  369.             in_keyTrack1 = PlayKey(indy, in_rtarmup, 4, 0x12, 1);    
  370.         }
  371.  
  372.         WaitForSound(curSound);
  373.  
  374.         if (gatesaid == 0)
  375.         {
  376.             StopKey(indy, in_keyTrack1, 0.5);
  377.             Sleep(0.5);
  378.         }
  379.         else
  380.         {
  381.             StopKey(indy, in_keyTrack1, 0.0);
  382.         }
  383.  
  384.         SetThingMaxRotVel(indy, in_rotRate);
  385.         SetThingFlags(indy, 0x80000);
  386.         ClearThingFlags(player, 0x80000);
  387.         ClearActorFlags(player, 0x200000); # restore control
  388.         gatesaid = 1;
  389.         EndCutScene();
  390.     }
  391.  
  392.     if (GetSenderRef() == sophia)
  393.     {
  394.         # Indy chats with Sophia near the switch
  395.  
  396.         # find indy's position relative to sophia
  397.         v_clvec = GetThingLVec(spot_object);
  398.         v_crvec = GetThingRVec(spot_object);
  399.         v_aimci = VectorSub((GetThingPos(spot_object)), (GetThingPos(player)));
  400.  
  401.         f_dotl = VectorDot(VectorNorm(v_aimci), v_clvec);
  402.         f_dotr = VectorDot(VectorNorm(v_aimci), v_crvec);
  403.  
  404.         if (f_dotl < 0)
  405.             {
  406.                 if (f_dotr < 0)
  407.                 {
  408.                 i_spot_WEorient = 0; #east
  409.                 }
  410.                 
  411.                 else if (f_dotr > 0)
  412.                 {
  413.                 i_spot_WEorient = 1; #west
  414.                 }
  415.             }
  416.         else 
  417.             {
  418.                 if (f_dotr < 0)
  419.                 {
  420.                 i_spot_NSorient = 0; #south
  421.                 }
  422.                 
  423.                 else if (f_dotr > 0)
  424.                 {
  425.                 i_spot_NSorient = 1; #north
  426.                 }
  427.             }
  428.         
  429.         # Prep...
  430.         curCam = GetCurrentCamera();
  431.         StartCutScene(1);
  432.         StopThing(player);
  433.         SetActorFlags(player, 0x200000);
  434.         AISetMode(sophia, 0x2000);
  435.         DeselectWeaponWait(player); # stow any weapon or lighter
  436.         
  437.         
  438.         Sleep(0.5); # wait a beat
  439.         CopyPlayerHolsters(player, indy); # make sure actor has matching props
  440.         in_rotRate = GetThingMaxRotVel(player);
  441.         so_rotRate = GetThingMaxRotVel(sophia);
  442.         SetThingMass(sophia, sophiaMass);
  443.         SetThingFlags(player, 0x80000);
  444.         ClearThingFlags(indy, 0x80000);
  445.         SetThingMaxRotVel(indy, 200.0);
  446.         SetThingMaxRotVel(sophia, 100.0);
  447.         TeleportThing(indy, player);
  448.  
  449. #        send message to hint cog to clear hint 40
  450.         SendMessage(hintcog, user0);
  451.  
  452.         # Slew follow camera to observe the scene from a known position            
  453.         if (i_spot_NSorient == 1)
  454.         {
  455.             SetExtCamOffsetToThing(cam5);
  456.         }
  457.  
  458.         if (i_spot_NSorient == 0)
  459.         {
  460.             SetExtCamOffsetToThing(cam5a);
  461.         }
  462.     
  463.         
  464.         Sleep(0.5);
  465.  
  466.         # Line up actors...
  467.         AISetLookThing(sophia, indy);
  468.         AISetLookThing(indy, sophia);
  469.         AIWaitForStop(sophia);
  470.  
  471.         if (switchTalkState == 0)
  472.         {
  473.             switchTalkState = 1;
  474.  
  475.             # Indy: "Here you are.  Find anything?"
  476.             PlayVoice(indy, in_line1, 1.0, 1);
  477.    
  478.             # Sophia: "Nothing spooky, if that's what you mean."
  479.             PlayKey(Sophia, so_nospook, 4, 0x12, 0);
  480.             PlayVoice(sophia, so_line1, 1.0, 1);
  481.             
  482.             # PlayKey(sophia, so_armup, 4, 0x0, 0);
  483.     
  484.             # Sophia: "What's this switch?"
  485.             PlayKey(sophia, so_whatswitch, 4, 0x12, 0);
  486.             PlayVoice(sophia, so_line2, 1.0, 1);
  487.  
  488.             If (gatesaid == 0)
  489.             {
  490.                 # NOTE: demo gate if player has never tried to open it
  491.                 
  492.                 
  493.                 # Cut to side shot from left...
  494.                 SetCameraFocus(2, cam1);
  495.                 SetCameraSecondaryFocus(2, camtarget1);
  496.                 SetCurrentCamera(2);
  497.                 SetCameraFOV(50, 0, 0.0);
  498.                 
  499.                 # teleport indy to a spot so as not to collide with sophia while using button
  500.                 TeleportThing(indy, in_nohitspot);
  501.                 Sleep(0.2);
  502.  
  503.                 # Move actors into position...
  504.                 AISetLookThing(sophia, indy);
  505.                 AISetMoveThing(sophia, so_move1, 0);
  506.                 AISetLookThing(indy, button);
  507.                 AISetMoveThing(indy, in_move1, 0);
  508.         
  509.                 # Indy: "It opens the gate up there."
  510.                 PlayVoice(indy, in_opengate, 1.0, 0);
  511.                 AIWaitForStop(indy);
  512.                 AISetLookThing(sophia, indy);
  513.     
  514.                 # Indy punches the button...
  515.                 PlayKey(indy, in_activate, 4, 0x12, 0);
  516.                 Sleep(0.2);
  517.                 MoveToFrame(button, 1, 0.5);
  518.                 Sleep(1.0);
  519.  
  520.                 # Slew camera...
  521.                 SetCameraPosInterp(2, 1); # dolly
  522.                 SetCameraLookInterp(2, 1); # pan & tilt
  523.                 SetCameraInterpSpeed(2, 2.5);
  524.                 Sleep(0.01);
  525.                 SetCameraFocus(2, cam2);
  526.                 SetCameraSecondaryFocus(2, camtarget2);
  527.                 SetCameraFOV(30, 1, 5.3);
  528.     
  529.                 # Indy and Sophia look toward gate offscreen...
  530.                 AISetLookThing(indy, inso_look_1); # target *seems* like look-to-gate
  531.                 AISetLookThing(sophia, gate);
  532.  
  533.                 # Gate opens...
  534.                 PlaySoundLocal(gatestart, 1.0, 0.0, 0x0, 0);
  535.                 MoveToFrame(gate, 1, openspeed);
  536.                 gate_snd0=PlaySoundLocal(gatemove, 1.0, 0.0, 0x1, 0);
  537.                 WaitForStop(gate);
  538.                 StopSound(gate_snd0, 0.0);
  539.                 PlaySoundLocal(gatestop, 1.0, 0.0, 0x0, 0);
  540.                 Sleep(1.0);
  541.                 
  542.                 # Fix stuff offscreen...
  543.                 MoveToFrame(button, 0, 3.0);
  544.                 TeleportThing(sophia, so_move2);
  545.                 TeleportThing(indy, in_move3);
  546.                 AISetLookThing(indy, inso_look_1); # make sure he swiveled all the way
  547.                 AISetLookThing(sophia, gate);
  548.  
  549.                 # Gate closes...
  550.                 PlaySoundLocal(gatestart, 1.0, 0.0, 0x0, 0);
  551.                 MoveToFrame(gate, 0, shutspeed);
  552.                 gate_snd0=PlaySoundLocal(gatemove, 1.0, 0.0, 0x1, 0);
  553.                 WaitForStop(gate);
  554.                 StopSound(gate_snd0, 0.0);
  555.                 PlaySoundLocal(gatestop, 1.0, 0.0, 0x0, 0);
  556.                 Sleep(0.5);
  557.  
  558.                 # Cut back to actors...
  559.                 SetCameraPosInterp(2, 0); # no dolly
  560.                 SetCameraLookInterp(2, 0); # no pan & tilt
  561.                 #PRINT("CAM 2 AT POSITION CAM5");
  562.                 SetCameraSecondaryFocus(2, finalshot_targ);
  563.                 SetCameraFocus(2, cam5);
  564.                 SetCurrentCamera(2);
  565.                 SetCameraFOV(80, 0, 0);
  566.                 #SetCurrentCamera(curCam);
  567.  
  568.                 gatesaid = 1;            
  569.             }
  570.             else
  571.             {
  572.                 AISetLookThing(indy, inso_look_1);
  573.                 PlayKey(indy, in_rtarmup, 4, 0x12, 0);
  574.                 Sleep(0.5);
  575.                 AISetLookThing(sophia, gate);
  576.     
  577.                 # Indy: "It opens the gate up there."
  578.                 PlayVoice(indy, in_opengate, 1.0, 1);
  579.             }
  580.             
  581.             # Indy: "Let me work my way into position, then push."
  582.             PlayKey(indy, in_rtarmup, 4, 0x12, 0);
  583.             PlayVoice(indy, in_workpush, 1.0, 1);
  584.  
  585.             # She turns back toward Indy...
  586.             AISetLookThing(sophia, indy);
  587.             
  588.             # Sophia: "Say when."
  589.             PlayKey(sophia, so_ltwave, 4, 0x12, 0);
  590.             PlayVoice(sophia, so_line3, 1.0, 1);
  591.         }
  592.         else
  593.         {
  594.             # Sophia: "What's this switch?"
  595.             PlayKey(sophia, so_whatswitch, 4, 0x12, 0);
  596.             PlayVoice(sophia, so_line2, 1.0, 1);
  597.             Sleep(0.25);
  598.             
  599.             # They turn toward the gate...
  600.             AISetLookThing(indy, inso_look_1);
  601.             AISetLookThing(sophia, gate);
  602.  
  603.             
  604.             # Indy: "It opens the gate up there."
  605.             PlayVoice(indy, in_opengate, 1.0, 1);
  606.             Sleep(0.25);
  607.             
  608.             # Sophia: "Say when."
  609.             AISetLookThing(sophia, indy);
  610.             PlayKey(sophia, so_ltwave, 4, 0x12, 0);
  611.             PlayVoice(sophia, so_line3, 1.0, 1);            
  612.         }
  613.                     
  614.         # clean up...    
  615.         TeleportThing(indy, in_move3); # align on gate
  616.         TeleportThing(player, indy); # align player too
  617.         SetThingFlags(indy, 0x80000);
  618.         ClearThingFlags(player, 0x80000);        
  619.         camPos = GetThingPos(cam1);
  620.         SetCurrentCamera(1);
  621.         SetCameraPosition(1, camPos); # prep to swing back to follow-cam
  622.         RestoreExtCam();
  623.         SetThingMaxRotVel(indy, 300);
  624.         SetThingMaxRotVel(sophia, so_rotRate);
  625.         SetThingMass(sophia, 0);
  626.         AIClearMode(sophia, 0x2000); # put her back in watch-indy mode
  627.         ClearActorFlags(player, 0x200000);
  628.         EndCutScene();
  629.     }
  630.  
  631.     if (GetSenderRef() == gate)
  632.     {
  633.         # Indy notes that the gate will be tough to open
  634.  
  635.         StartCutScene(1); # change to 0 when it works!
  636.         StopThing(player);
  637.         SetActorFlags(player, 0x200000);
  638.  
  639.         # TO DO: substitute Matt R's new verb here...
  640.  
  641.         # Slew follow camera to observe the scene from a known position
  642.         if (beyondgate == 0)
  643.         {
  644.             slewcam = cam4;
  645.         }
  646.         else
  647.         {
  648.             slewcam = cam12;
  649.         }
  650.         SetExtCamOffsetToThing(slewcam);
  651.         Sleep(0.5);
  652.  
  653.         # Indy comments on unbreachable barrier...
  654.         if (whipsaid == 0)
  655.         {
  656.             # Indy: "That gate looks pretty sturdy...not sure smash..."
  657.             PlayVoice(player, in_sturdygate, 2, 1);
  658.             Sleep(0.5);
  659.         }
  660.         else
  661.         {
  662.             call randnobudgelines;
  663.             WaitForSound(curSound);
  664.         }
  665.  
  666.         RestoreExtCam();
  667.         whipsaid = 1;
  668.         ClearActorFlags(player, 0x200000);
  669.         EndCutScene();
  670.     }
  671.  
  672.     return;
  673.  
  674. # ..............................................................................
  675.  
  676. damaged:
  677.  
  678.     if ((GetSenderRef() == strut) && (GetParam(1) == 0x10) && (switchTalkState > 0))
  679.     {
  680.         # Indy whips across the gap...
  681.         
  682.         # Prep...
  683.         StartCutScene(1);
  684.         curCam = GetCurrentCamera();
  685.         SetCameraPosInterp(2, 0); # kill dolly
  686.         SetCameraLookInterp(2, 0); # kill pan & tilt
  687.  
  688.         beyondgate = 1;
  689.         
  690.         # Cut to Indy as he swings over the lava...
  691.         SetCameraFocus(2, cam6);
  692.         SetCameraSecondaryFocus(2, player);
  693.         SetCurrentCamera(2);
  694.         SetCameraFOV(70, 0, 0.0);
  695.         
  696.         # heroic music cue
  697.         PlaySoundLocal(whip_cue, 1.0, 0.0, 0x0, 0);
  698.  
  699.         Sleep(0.01);
  700.         SetCameraFOV(40, 1, 11.5);
  701.         MoveToFrame(cam6, 1, 0.3);
  702.     }
  703.  
  704.     return;
  705.  
  706. # ..............................................................................
  707.  
  708. entered:
  709.  
  710.     if ((GetSenderRef() == rockface) && (switchTalkState > 0))
  711.     {       
  712.         # Sophia activates the gate and Indy runs through
  713.  
  714.         SetActorFlags(player, 0x200000);
  715.         DeselectWeapon(player); # stow any weapon or lighter
  716.         Sleep(0.8); # wait a beat
  717.         CopyPlayerHolsters(player, indy); # make sure actor has matching props
  718.         SetThingFlags(player, 0x80000);
  719.         ClearThingFlags(indy, 0x80000);
  720.         TeleportThing(indy, player);
  721.  
  722.         # Indy lands just outside the gate and turns toward Sophia...
  723.         Sleep(0.2);
  724.         AISetLookThing(indy, sophia);
  725.         AIWaitForStop(indy);
  726.         PlayKey(indy, in_brushoff, 4, 0x12, 1);
  727.  
  728.         
  729.         PlayKey(indy, in_ltarmup, 4, 0x12, 0);
  730.         Sleep(0.3);
  731.  
  732.         # Indy: "Push, Sophia."
  733.         PlayVoice(indy, in_line3, 2, 1);
  734.         Sleep(0.2);
  735.  
  736.         # Cut to Sophia as she moves into position...
  737.         SetCameraFocus(2, cam1);
  738.         SetCameraSecondaryFocus(2, button);
  739.         SetCameraFOV(30, 0, 0.0);
  740.         AISetLookThing(sophia, button);
  741.         AISetMoveSpeed(sophia, 1);
  742.         AISetMoveThing(sophia, so_switchpos, 0);
  743.         Sleep(1.0);
  744.  
  745.         # Sophia pushes the button...
  746.         PlayKey(sophia, so_pushbutton, 4, 0x12, 0);
  747.         Sleep(0.2);
  748.         MoveToFrame(button, 1, 0.5);
  749.  
  750.         # Turn Indy around...
  751.         AISetLookThing(indy, in_move4);
  752.         Sleep(0.5);
  753.  
  754.         # Sophia walks toward bridge...
  755.         AISetMoveSpeed(sophia, 1.2);
  756.         AISetLookThing(sophia, so_move3);
  757.         AISetMoveThing(sophia, so_move3, 0);
  758.         Sleep(1.0);
  759.  
  760.         # Cut to Indy from beyond gate...
  761.         SetCameraFocus(2, cam7);
  762.         SetCameraSecondaryFocus(2, camtarget3);
  763.         SetCameraFOV(65, 0, 0.0);
  764.  
  765.         # The Gate opens...
  766.         PlaySoundLocal(gatestart, 1.0, 0.0, 0x0, 0);
  767.         MoveToFrame(gate, 1, openspeed);
  768.         gate_snd0=PlaySoundLocal(gatemove, 1.0, 0.0, 0x1, 0);
  769.         Sleep(0.5);
  770.         
  771.         # Indy runs through...
  772.         AISetMoveSpeed(indy, 3.2); # make him run
  773.         AISetMoveThing(indy, in_move4, 0);
  774.         # partition next sleep for accurate timing
  775.         Sleep(1.5);
  776.         StopSound(gate_snd0, 0.0);
  777.         PlaySoundLocal(gatestop, 1.0, 0.0, 0x0, 0);
  778.         
  779.         # The gate closes...
  780.         PlaySoundLocal(gatestart, 1.0, 0.0, 0x0, 0);
  781.         MoveToFrame(gate, 0, shutspeed);
  782.         gate_snd0=PlaySoundLocal(gatemove, 1.0, 0.0, 0x1, 0);
  783.         Sleep(0.5);    #this sleep may need to be extended    for accurate timing
  784.         StopSound(gate_snd0, 0.0);
  785.         PlaySoundLocal(gatestop, 1.0, 0.0, 0x0, 0);
  786.         AIWaitForStop(indy); # he runs out of frame right
  787.         
  788.         # Cut to Sophia through the closed gate...
  789.         SetCameraFocus(2, cam8);
  790.         SetCameraSecondaryFocus(2, camtarget4);
  791.         SetCameraFOV(20, 0, 0.0); # temp FOV
  792.  
  793.         # Move Indy offscreen...
  794.         TeleportThing(indy, in_move5);
  795.         AIWaitForStop(sophia);
  796.         AISetLookThing(sophia, indy);
  797.         
  798.         # Sophia: "Indy, you okay?"
  799.         curSound = PlayVoice(sophia, so_line4, 1, 0);
  800.         PlayKey(sophia, so_youokay, 4, 0x12, 0);
  801.  
  802.         # Indy approaches the gate...
  803.         AISetLookThing(indy, sophia);
  804.         AISetMoveSpeed(indy, 1.2);
  805.         AISetMoveThing(indy, in_move6, 1);
  806.         WaitForSound(curSound);
  807.         
  808.         # Indy: "I can't open it from this side."
  809.         PlayKey(indy, in_grunt, 4, 0x12, 0);
  810.         Sleep(1.0);
  811.         PlayVoice(indy, in_line4, 1, 1);
  812.         
  813.         # Sophia: "Doesn't matter.  I've got some spying to do."
  814.         curSound = PlayVoice(sophia, so_line5, 1, 0);
  815.  
  816.         # She starts to leave...
  817.         AISetLookThing(sophia, so_move4);
  818.         AISetMoveSpeed(sophia, 1.0);
  819.         AISetMoveThing(sophia, so_move4, 0);
  820.         WaitForsound(curSound);
  821.  
  822.         # Cut to Indy behind bars...
  823.         StopThing(sophia); # cheat her to an unseen stop
  824.         SetCameraFocus(2, cam9);
  825.         SetCameraSecondaryFocus(2, camtarget5);
  826.         SetCameraFOV(25, 0, 0.0);
  827.         Sleep(0.5);
  828.  
  829.         # Indy: "Wait...premonition...still got it?"            
  830.         curSound = PlayVoice(indy, in_line5, 1, 0);
  831.         PlayKey(indy, in_rtarmup, 4, 0x12, 0);
  832.         WaitForSound(curSound);
  833.  
  834.         
  835.  
  836.         # Cut back to Sophia...
  837.         AISetMoveThing(sophia, so_move4, 0); # she resumes her exit
  838.         SetCameraFocus(2, cam10);
  839.         SetCameraSecondaryFocus(2, camtarget6);
  840.         SetCameraFOV(45, 0, 0.0);
  841.         Sleep(0.01);
  842.         SetCameraFOV(30, 1, 4.8); # was 4.5
  843.  
  844.         
  845.         # Sophia: "Yes...danger farther...you'll be fine...for now."
  846.         curSound = PlayVoice(sophia, so_line6, 1, 0);
  847.         Sleep(3.5);
  848.  
  849.         # play fear cue as she alludes to fire beast
  850.         fadechan=PlaySoundLocal(fear_cue, 0.5, 0.0, 0x0, 0);
  851.         
  852.         # She moves out of sight around the corner...
  853.         AISetLookThing(sophia, so_move5);
  854.         AISetMoveThing(sophia, so_move5, 0);
  855.         WaitForSound(curSound);
  856.  
  857.         # fade music down
  858.         ChangeSoundVol(fadechan, 0.3, 1.0);
  859.  
  860.         # Cut to Indy...
  861.         TeleportThing(indy, in_move7);
  862.         SetCameraFocus(2, cam11);
  863.         SetCameraSecondaryFocus(2, camtarget7);
  864.         SetCameraFOV(50, 0, 0.0);
  865.         
  866.         # Indy: "I like her optimism."
  867.         curSound = PlayVoice(indy, in_line6, 1, 0);
  868.         PlayKey(indy, chinrub, 4, 0x12, 0);        
  869.         WaitForSound(curSound);
  870.     
  871.         # Clean up...
  872.         DestroyThing(sophia);
  873.         TeleportThing(player, indy);
  874.         SetThingFlags(indy, 0x80000);
  875.         ClearThingFlags(player, 0x80000);
  876.         ClearActorFlags(player, 0x200000);
  877.         camPos = GetThingPos(cam11);
  878.         SetCameraPosition(1, camPos); # prep to swing back to follow-cam
  879.         SetCurrentCamera(curCam);
  880.         RestoreExtCam();
  881.         ReSetCameraFOV(0, 0.0);
  882.         EndCutScene();
  883.     }
  884.  
  885.     return;
  886.  
  887. # ..............................................................................
  888.  
  889. randneglines:
  890.  
  891.     # NOTE: Player-Indy randomly complains about the gate
  892.     # without ever saying the same line twice in a row
  893.     
  894.     while (newline == oldline)
  895.     {    
  896.         newline = RandBetween(1, 3); # pick new line
  897.     }
  898.     oldline = newline; # remember what got picked
  899.  
  900.     if (newline == 1)
  901.     {
  902.         curSound = PlayVoice(player, in_nowork, 1.0, 0);
  903.     }    
  904.     if (newline == 2)
  905.     {
  906.         curSound = PlayVoice(player, in_notquitework, 1.0, 0);
  907.     }
  908.     if (newline == 3)
  909.     {
  910.         PlayVoice(player, in_nowork, 1.0, 1);
  911.         curSound = PlayVoice(player, in_differentway, 1.0, 0);
  912.     }
  913.  
  914.     return;
  915.  
  916. # ..............................................................................
  917.  
  918. randnobudgelines:
  919.  
  920.     # NOTE: Player-Indy randomly complains about the gate
  921.     # without ever saying the same line twice in a row
  922.     
  923.     while (newline == oldline)
  924.     {    
  925.         newline = RandBetween(1, 3); # pick new line
  926.     }
  927.     oldline = newline; # remember what got picked
  928.  
  929.     if (newline == 1)
  930.     {
  931.         curSound = PlayVoice(player, in_cantopen, 1.0, 0);
  932.     }    
  933.     if (newline == 2)
  934.     {
  935.         curSound = PlayVoice(player, in_nobudge, 1.0, 0);
  936.     }
  937.     if (newline == 3)
  938.     {
  939.         curSound = PlayVoice(player, in_holdingdoor, 1.0, 0);
  940.     }
  941.  
  942.     return;
  943.  
  944. # ..............................................................................
  945.  
  946. blocked:
  947.  
  948.     #Print("Got a blocked message");
  949.  
  950.     return;
  951.  
  952. end
  953.  
  954.